Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

361
Visualizações
Access Blazor object[] from Javascript without passing data through unmarshalled call

Just want to highlight that I have been at this for about a week and am new to dealing with the heap and pointers and have not had to interact directly with it before. Could really use some help as I have not made any progress.

Problem statement: Need to access an object[] that I created on Blazor side from Javascript without the use of JSUnmarshalled call from Blazor to pass the data in.

Why? Using the JSUnmarshalled call is still too slow for how large the object[] is even though it only takes .25ms (yes .25ms) to actually create the entire array. The array takes 2 seconds to pass to JS. This is a problem because I am rapidly making adjustments based on user input and most time is spent on waiting for the data to be passed over which causes poor user experience.

What I am currently doing:

c# side

JSUnmarshalledRuntime.InvokeUnmarshalled<object[], object>("InitializeGeometry", RenderModel.GetCombined());

InitializeGeometry calls this JS function to process the object[]

JS side

function getInt32Heap(data) {
var m = data + 12;
var r = Module.HEAP32[m >> 2]
return Array.from(new Int32Array(Module.HEAP32.buffer, m + 4, r));}

This is working fine but is quite slow. What I have tried to find is a way to create a pointer for the object[] on the Blazor side and then pass it into JS. Then on the JS side figure out how to use that pointer to get the same data out that I am currently getting.

I have reached out to the .Net team and this is my original question. https://github.com/dotnet/aspnetcore/issues/41490

Here is what I have looked through https://github.com/dotnet/aspnetcore/blob/main/src/Components/Web.JS/src/Rendering/RenderBatch/SharedMemoryRenderBatch.ts

Also found this https://github.com/SteveSandersonMS/BlazorInputFile/blob/db10236b049ea05de28de9b7806447a3c84c8465/BlazorInputFile/wwwroot/inputfile.js#L113

And this https://blog.elmah.io/using-js-object-references-in-blazor-wasm-to-wrap-js-libraries/?msclkid=9826568bcf8d11ecbdab91d116441786

Again, I am new to this so the answers may be in here but I am not seeing them. I know this is due to my lack of understanding but so far I have not read anything that puts things into perspective for me. Any help would be greatly appreciated!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda